﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>新增产品分类</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="/style/admin/style/adminStyle.css" rel="stylesheet" type="text/css" />
        <script src="/style/admin/js/jquery.js"></script>
    </head>
    <body>
        <div class="wrap">
            <div class="page-title">
                <span class="modular fl"><i></i><em>添加分类</em></span>
            </div>

            <table class="list-style">
                <form action="" id="Category_Add" onsubmit="return false" >
                    <tr>
                        <td style="text-align:right;width:15%;">分类名称：</td>
                        <td>
                            <input type="text" name="name" class="textBox"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;width:10%;">上级分类：</td>
                        <td>
                            <select class="textBox" name="pid">
                                <option value="{{$data->id}}">{{$data->name}}</option>  
                            </select>
                        </td>
                        <input type="hidden" name="path" value="{{$data->path}}{{$data->id}},"/>
                    </tr>
                    <tr>
                        <td style="text-align:right;">数量单位：</td>
                        <td>
                            <input type="text" name="unit" class="textBox length-short"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">排序：</td>
                        <td>
                            <input type="text" name="sort" class="textBox length-short"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">是否显示：</td>
                        <td>
                            <input type="radio" name="is_show" value="1" checked id="yes"/>
                            <label for="yes">是</label>
                            <input type="radio" name="is_show" value="0" id="no"/>
                            <label for="no">否</label>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">是否楼层：</td>
                        <td>
                            <input type="radio" name="is_lou" value="1" checked id="yes"/>
                            <label for="yes">是</label>
                            <input type="radio" name="is_lou" value="0" id="no"/>
                            <label for="no">否</label>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">分类页面标题：</td>
                        <td>
                            <input type="text" name="title" class="textBox length-long"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">分类页面关键词：</td>
                        <td>
                            <input type="text" name="keywords" class="textBox length-long"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">分类页面描述：</td>
                        <td>
                            <textarea class="textarea" name="description"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;"></td> 
                        <td><input type="submit" value="保存" onclick="add_son()" class="tdBtn"/></td>
                    </tr>
                </form>
            </table>
        </div>
    </body>
    <script>
           function add_son(){ 
                var form = $('#Category_Add').serialize();  //序列化内容
                 str = decodeURIComponent(form,true); //将数据解码
                $.post('/admin/goods_category',{str:str,'_token':'{{csrf_token()}}'},function(data){
                       if(data==1){
                           window.location.href="/admin/goods_category";
                       }else{
                           alert("添加失败");
                       }
               })
           }
    </script>
</html>